<!--
 * @Author: your name
 * @Date: 2022-01-05 16:44:01
 * @LastEditTime: 2022-01-05 17:04:41
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \20220105\浮动.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
        }
        .red{
            background-color: red;
            margin-left: 100px;
        }
        .black{
            background-color: black;
            margin-right: 100px;
        }
        .blue{
            background: blue;
            width: 600px;
            /* 设置左浮动 */
            margin-left: 500px;
        }
        /* 浮动：是标签脱离原本的文档流 float:left;  float:right;
           特性：由于脱离原本文档流，原本所占空间现在腾出来
        */
        .left{
            float: left;
        }
        .right{
            float: right;
        }
        /* 清除浮动的影响 */
        .clear{
            clear: both;
        }
    </style>
</head>
<body>
    <div class="blue">

    </div>
    <div class="red left">

    </div>
    <div class="black right">

    </div>
    <div class="blue clear">

    </div>
</body>
</html>
